package cn.epsilon3.constant;

import cn.epsilon3.exception.Epsilon3ReturnException;

/**
 * 回调 常量key 枚举
 *
 * @author epsilon3
 * @date 2023-05-08
 */
public enum SSOChannelEnum {


    /**
     * hashMap param key
     */
    GITHUB_CHANNEL("20205243166"),
    ALIPAY_CHANNEL("110751295"),
    ;
    private final String key;

    SSOChannelEnum(String key) {
        this.key = key;
    }

    public String getKey() {
        return key;
    }

    public static SSOChannelEnum getChannel(String channel) {
        for (SSOChannelEnum ssoChannelEnum : SSOChannelEnum.values()) {
            if (ssoChannelEnum.key.equals(channel)) {
                return ssoChannelEnum;
            }
        }
        throw new Epsilon3ReturnException("未知的渠道类型");
    }

    @Override
    public String toString() {
        return "Oauth2Enum{" +
                "key='" + key + '\'' +
                '}';
    }
}

